#ifndef MYTCPSERVER_H
#define MYTCPSERVER_H

#include "mytcpsocket.h"

#include <QObject>
#include <QTcpServer>

class MyTcpServer : public QTcpServer
{
    Q_OBJECT
public:
    // 返回单例模式下的静态实例
    static MyTcpServer& getInstance();

    void incomingConnection(qintptr handle);
    void resend(char* tarName, PDU* pdu);

public slots:
    void removeSocket(MyTcpSocket* mysocket);

private:
    // 单例模式
    MyTcpServer();
    MyTcpServer(const MyTcpServer& instance)     = delete;
    MyTcpServer& operator = (const MyTcpServer&) = delete;

    // 连接的套接字列表
    QList<MyTcpSocket*> m_tcpSocketList;
};

#endif // MYTCPSERVER_H
